<?php

/**
 *    前台控制器基础类
 *
 *    @author liangcajian QQ632324010
 *    @usage    none
 */
class FrontendApp extends ECBaseApp
{
    function __construct()
    {
        $this->FrontendApp();
    }
    function FrontendApp()
    {
        Lang::load(lang_file('common'));
        Lang::load(lang_file(APP));
        parent::__construct();

        // 判断商城是否关闭
        if (!Conf::get('site_status'))
        {
            $this->show_warning(Conf::get('closed_reason'));
            exit;
        }
        # 在运行action之前，无法访问到visitor对象
    }

    function _config_view()
    {
        parent::_config_view();
        $this->_view->template_dir  = ROOT_PATH . '/themes';
        $this->_view->compile_dir   = ROOT_PATH . '/temp/compiled/mall';
        $this->_view->res_base      = SITE_URL . '/themes';
        $this->_config_seo(array(
            'title' => Conf::get('site_title'),
            'description' => Conf::get('site_description'),
            'keywords' => Conf::get('site_keywords')
        ));
    }

	function display($tpl,$cache_id = '')
    {		
        //$cart =& m('cart');
        //$this->assign('cart_goods_kinds', $cart->get_kinds(SESS_ID, $this->visitor->get('user_id')));
		$this->assign('cart_goods_kinds', 0);
        $this->assign('navs', $this->_get_navs());  // 自定义导航
		//$this->assign('gcategorys', $this->_list_gcategory()); /*商品分类*/
        $this->assign('acc_help', ACC_HELP);        // 帮助中心分类code
        $this->assign('site_title', Conf::get('site_title'));
		$this->assign('site_name', Conf::get('site_name'));
		$this->assign('site_logo', Conf::get('site_logo'));
		$this->assign('subdomain_suffix', SUBDOMAIN_SUFFIX);
		$this->assign('config', array( 
			'service_tel'=>Conf::get('service_tel'),//客服电话
			'icp_number'=>Conf::get('icp_number'),//备案号
			'rewrite_enabled'=>Conf::get('rewrite_enabled'),//是否伪静态
			'statistics_code'=>Conf::get('statistics_code'), //统计代码
		));

        //parent::display($tpl,1);
		parent::display($tpl,$cache_id);
	}
	
	//添加操作日志 by liangcaijian
	function write_log($user_id, $user_name, $log_value, $type = 0, $lexing = 0)
	{
		if($user_id and $user_name and $log_value)
		{
		  //取得本月的第几个星期，一个星期打一个日志
		  $date_now=date("j"); //得到几号
		  $cal_result = "_" . ceil($date_now/7). "week"; //计算是第几个星期几
		  $filename = ROOT_PATH . "/temp/log_web/" .date("Y_m"). $cal_result . ".log";//date("Y_m")
		  if (!is_dir('temp/log_web'))
		  {
			  ecm_mkdir(ROOT_PATH . '/' . 'temp/log_web');
		  }   
		  $handler = null;
		  if (($handler = fopen($filename, 'ab+')) !== false)
		  {
			  fwrite($handler, $type .'///'. $user_id .'///'. $user_name .'///'. real_ip() .'///'. date("Y-m-d H:i:s") .'///'. $log_value ."\n");
			  fclose($handler);
		  }		          
//			$log_mod =& m('log');
//			$log_mod->add(array( 'type' => $type, 'user_id' => $user_id, 'user_name' => $user_name, 'log_value' => $log_value, 'ip' => real_ip(), 'addtime' => gmtime() ));
		}
	}

    /* 执行登录动作 */
    function _do_login($user_id)
    {
        $mod_user =& m('member');
        $user_info = $mod_user->get(array(
            'conditions'    => "user_id = '{$user_id}'",
            //'join'          => 'has_store', //关联查找看看是否有店铺
            'fields'        => 'user_id, user_name, reg_time, last_login, last_ip',//store_id
        ));

        /* 分派身份 */
        $this->visitor->assign($user_info);

        /* 更新用户登录信息 */
        $mod_user->edit("user_id = '{$user_id}'", "last_login = '" . gmtime()  . "', last_ip = '" . real_ip() . "', logins = logins + 1");
	
        /* 更新购物车中的数据 */
//        $mod_cart =& m('cart');
//        $my_store = empty($user_info['store_id']) ? 0 : $user_info['store_id'];/* 店铺ID */
//        $mod_cart->edit("(user_id = '{$user_id}' OR session_id = '" . SESS_ID . "') AND store_id <> '{$my_store}'", array(
//            'user_id'    => $user_id,
//            'session_id' => SESS_ID,
//        ));

        /* 去掉重复的项 */
//        $cart_items = $mod_cart->find(array(
//            'conditions'    => "user_id='{$user_id}' GROUP BY spec_id",
//            'fields'        => 'COUNT(spec_id) as spec_count, spec_id, rec_id',
//        ));
//        if (!empty($cart_items))
//        {
//            foreach ($cart_items as $rec_id => $cart_item)
//            {
//                if ($cart_item['spec_count'] > 1)
//                {
//                    $mod_cart->drop("user_id='{$user_id}' AND spec_id='{$cart_item['spec_id']}' AND rec_id <> {$cart_item['rec_id']}");
//                }
//            }
//        }
    }	

    function pop_warning ($msg, $dialog_id = '',$url = '')
    {
        if($msg == 'ok')
        {
            if(empty($dialog_id))
            {
                $dialog_id = APP . '_' . ACT;
            }
            if (!empty($url))
            {
                echo "<script type='text/javascript'>window.parent.location.href='".$url."';</script>";
            }
            echo "<script type='text/javascript'>window.parent.js_success('" . $dialog_id ."');</script>";
        }
        else
        {
            header("Content-Type:text/html;charset=".CHARSET);
            $msg = is_array($msg) ? $msg : array(array('msg' => $msg));
            $errors = '';
            foreach ($msg as $k => $v)
            {
                $error = $v[obj] ? Lang::get($v[msg]) . " [" . Lang::get($v[obj]) . "]" : Lang::get($v[msg]);
                $errors .= $errors ? "<br />" . $error : $error;
            }
            echo "<script type='text/javascript'>window.parent.js_fail('" . $errors . "');</script>";
        }
    }
    /* 取得导航 */
    function _get_navs()
    {
        $cache_server =& cache_server();
        $key = 'common.navigation';
        $data = $cache_server->get($key);
        if($data === false)
        {
            $data = array(
                'header' => array(),
                'middle' => array(),
                'footer' => array(),
            );
            $nav_mod =& m('navigation');
            $rows = $nav_mod->find(array(
                'order' => 'type, sort_order',
            ));
            foreach ($rows as $row)
            {
                $data[$row['type']][] = $row;
            }
            $cache_server->set($key, $data, 864000);
        }

        return $data;
    }
	
    /**
     *    获取JS语言项
     *
     *    @author liangcajian QQ632324010
     *    @param    none
     *    @return    void
     */
    function jslang()
    {
        $lang = Lang::fetch(lang_file('jslang'));
        parent::jslang($lang);
    }

    /**
     *    视图回调函数[显示小挂件]
     *
     *    @author liangcajian QQ632324010
     *    @param     array $options
     *    @return    void
     */
    function display_widgets($options)
    {
        $area = isset($options['area']) ? $options['area'] : '';
        $page = isset($options['page']) ? $options['page'] : '';
        if (!$area || !$page)
        {
            return;
        }
        include_once(ROOT_PATH . '/includes/widget.base.php');

        /* 获取该页面的挂件配置信息 */
        $widgets = get_widget_config($this->_get_template_name(), $page);

        /* 如果没有该区域 */
        if (!isset($widgets['config'][$area]))
        {
            return;
        }

        /* 将该区域内的挂件依次显示出来 */
        foreach ($widgets['config'][$area] as $widget_id)
        {
            $widget_info = $widgets['widgets'][$widget_id];
            $wn     =   $widget_info['name'];
            $options=   $widget_info['options'];

            $widget =& widget($widget_id, $wn, $options);
            $widget->display();
        }
    }

    /**
     *    获取当前使用的模板名称
     *
     *    @author liangcajian QQ632324010
     *    @return    string
     */
    function _get_template_name()
    {
        return 'default';
    }

    /**
     *    获取当前使用的风格名称
     *
     *    @author liangcajian QQ632324010
     *    @return    string
     */
    function _get_style_name()
    {
        return 'default';
    }

    /**
     *    当前位置
     *
     *    @author liangcajian QQ632324010
     *    @param    none
     *    @return    void
     */
    function _curlocal($arr)
    {
        $curlocal = array(array(
            'text'  => Lang::get('index'),
            'url'   => SITE_URL . '/',
        ));
        if (is_array($arr))
        {
            $curlocal = array_merge($curlocal, $arr);
        }
        else
        {
            $args = func_get_args();
            if (!empty($args))
            {
                $len = count($args);
                for ($i = 0; $i < $len; $i += 2)
                {
					$curlocal[] = array(
                        'text'  =>  $args[$i],
                        'url'   =>  $args[$i+1],
                    );
                }
            }
        }

        $this->assign('_curlocal', $curlocal);
    }
    function _init_visitor()
    {
        $this->visitor =& env('visitor', new UserVisitor());
    }
			
}
/**
 *    前台访问者
 *
 *    @author liangcajian QQ632324010
 *    @usage    none
 */
class UserVisitor extends BaseVisitor
{
    var $_info_key = 'user_info';

    /**
     *    退出登录
     *
     *    @author liangcajian QQ632324010
     *    @param    none
     *    @return    void
     */
    function logout()
    {
        /* 将购物车中的相关项的session_id置为空 */
        $mod_cart =& m('cart');
        $mod_cart->edit("user_id = '" . $this->get('user_id') . "'", array(
            'session_id' => '',
        ));

        /* 退出登录 */
        parent::logout();
    }
}
/**
 *    商城控制器基类
 *
 *    @author liangcajian QQ632324010
 *    @usage    none
 */
class MallbaseApp extends FrontendApp
{
    function _run_action()
    {
		/* 只有登录的用户才可访问 */
        if (!$this->visitor->has_login && in_array(APP, array('apply')))
        {
            header('Location: index.php?app=member&act=login&ret_url=' . rawurlencode($_SERVER['PHP_SELF'] . '?' . $_SERVER['QUERY_STRING']));

            return;
        }

        parent::_run_action();
    }

    function _config_view()
    {
        parent::_config_view();

        $template_name = $this->_get_template_name();
        $style_name    = $this->_get_style_name();

        $this->_view->template_dir = ROOT_PATH . "/themes/{$template_name}";
        $this->_view->compile_dir  = ROOT_PATH . "/temp/compiled/{$template_name}";
        $this->_view->res_base     = SITE_URL . "/themes/{$template_name}/styles";
		$this->_view->cache_dir    = ROOT_PATH . "/temp/caches_html/{$template_name}";//缓存模板目录 by liangcaijian
		
    }

    /* 取得支付方式实例 */
    function _get_payment($code, $payment_info)
    {
        include_once(ROOT_PATH . '/includes/payment.base.php');
        include(ROOT_PATH . '/includes/payments/' . $code . '/' . $code . '.payment.php');
        $class_name = ucfirst($code) . 'Payment';

        return new $class_name($payment_info);
    }

    /**
     *   获取当前所使用的模板名称
     *
     *    @author liangcajian QQ632324010
     *    @return    string
     */
    function _get_template_name()
    {
        $template_name = Conf::get('template_name');
        if (!$template_name)
        {
            $template_name = 'default';
        }

        return $template_name;
    }

    /**
     *    获取当前模板中所使用的风格名称
     *
     *    @author liangcajian QQ632324010
     *    @return    string
     */
    function _get_style_name()
    {
        $style_name = Conf::get('style_name');
        if (!$style_name)
        {
            $style_name = 'default';
        }

        return $style_name;
    }
}

/**
 *    购物流程子系统基础类
 *
 *    @author liangcajian QQ632324010
 *    @usage    none
 */
class ShoppingbaseApp extends MallbaseApp
{
    function _run_action()
    {
        /* 只有登录的用户才可访问 */
        if (!$this->visitor->has_login && !in_array(ACT, array('login', 'register', 'check_user')))
        {
            if (!IS_AJAX)
            {
                header('Location:index.php?app=member&act=login&ret_url=' . rawurlencode($_SERVER['PHP_SELF'] . '?' . $_SERVER['QUERY_STRING']));
                return;
            }
            else
            {
                $this->json_error('login_please');
                return;
            }
        }

        parent::_run_action();
    }
}

/**
 *    用户中心子系统基础类
 *
 *    @author liangcajian QQ632324010
 *    @usage    none
 */
class MemberbaseApp extends MallbaseApp
{
    function _run_action()
    {
		
        /* 只有登录的用户才可访问 */
        if (!$this->visitor->has_login && !in_array(ACT, array('login', 'register', 'check_user', 'login_index')))
        {
            if (!IS_AJAX)
            {
                header('Location:index.php?app=member&act=login&ret_url=' . rawurlencode($_SERVER['PHP_SELF'] . '?' . $_SERVER['QUERY_STRING']));
                return;
            }
            else
            {
                $this->json_error('login_please');
                return;
            }
        }

        parent::_run_action();
    }
    /**
     *    当前选中的菜单项
     *
     *    @author liangcajian QQ632324010
     *    @param     string $item
     *    @return    void
     */
    function _curitem($item)
    {
        $this->assign('has_store', $this->visitor->get('has_store'));
        $this->assign('_member_menu', $this->_get_member_menu());
        $this->assign('_curitem', $item);
    }
    /**
     *    当前选中的子菜单
     *
     *    @author liangcajian QQ632324010
     *    @param     string $item
     *    @return    void
     */
    function _curmenu($item)
    {
        $_member_submenu = $this->_get_member_submenu();
        foreach ($_member_submenu as $key => $value)
        {
            $_member_submenu[$key]['text'] = isset($value['text']) ? $value['text'] : Lang::get($value['name']);
        }
        $this->assign('_member_submenu', $_member_submenu);
        $this->assign('_curmenu', $item);
    }
    /**
     *    获取子菜单列表
     *
     *    @author liangcajian QQ632324010
     *    @param    none
     *    @return    void
     */
    function _get_member_submenu()
    {
        return array();
    }
    /**
     *    获取用户中心全局菜单列表
     *
     *    @author liangcajian QQ632324010
     *    @param    none
     *    @return    void
     */
    function _get_member_menu()
    {
		
        $menu = array();
		//转运常用功能
        $menu['my_kuaidi'] = array( 'name'  => 'my_kuaidi', 'text'  => '快递运单',
            'submenu'   => array(
                'my_kdorderadd'  => array( 'text' => '填写发货运单',  'url'  => 'index.php?app=my_kdorder&act=add', 'name' => 'my_kdorderadd', ),
				'my_kdorder'  => array( 'text' => '我的运单列表',  'url'  => 'index.php?app=my_kdorder', 'name' => 'my_kdorder', ),
				'my_address'  => array( 'text' => '地址薄',  'url'  => 'index.php?app=my_address', 'name' => 'my_address', ),
            ),
        );
		//预报系统和取件系统
        $menu['my_yubao'] = array( 'name'  => 'my_yubao', 'text'  => '预报/取件',
            'submenu'   => array(
                'my_kdyubaoadd'  => array( 'text' => '（包裹）到货预报',  'url'  => 'index.php?app=my_kdyubao&act=add', 'name' => 'my_kdyubaoadd', ),
				'my_kdyubao'  => array( 'text' => '（包裹）入库记录列表',  'url'  => 'index.php?app=my_kdyubao', 'name' => 'my_kdyubao', ),
                'my_kdqujiandd'  => array( 'text' => '（取件）预约取件',  'url'  => 'index.php?app=my_kdqujian&act=add', 'name' => 'my_kdqujianadd', ),
				'my_kdqujian'  => array( 'text' => '（取件）我的预约记录',  'url'  => 'index.php?app=my_kdqujian', 'name' => 'my_kdqujian', ),				
            ),
        );	
		//资金管理
		$menu['my_money'] = array( 'name'  => 'my_money', 'text'  => Lang::get('my_money'),
            'submenu'   => array(
                'remit_alipay'  => array(
                    'text'  => Lang::get('remit_alipay'),
                    'url'   => 'index.php?app=my_money&act=remit_alipay',
                    'name'  => 'remit_alipay',
                ),	
//				'remit_bank'  => array(
//                    'text'  => Lang::get('remit_bank'),
//                    'url'   => 'index.php?app=my_money&act=remit_bank',
//                    'name'  => 'remit_bank',
//                ),
                'audit_ailpay'  => array(
                    'text'  => Lang::get('audit_ailpay'),
                    'url'   => 'index.php?app=my_money&act=audit_ailpay',
                    'name'  => 'audit_ailpay',
                ),
                'my_money_index'  => array(
                    'text'  => Lang::get('my_money_index'),
                    'url'   => 'index.php?app=my_money',
                    'name'  => 'my_money_index',
                ),
				'setpaypassword'  => array(
                    'text'  => Lang::get('setpaypassword'),
                    'url'   => 'index.php?app=my_money&act=setpaypassword',
                    'name'  => 'setpaypassword',
                ),		
			),
		);			
		//帐户设置
        $menu['my_mall'] = array( 'name'  => 'my_mall', 'text'  => Lang::get('my_ecmall'),
            'submenu'   => array(
                'my_profile'  => array( 'text' => Lang::get('my_profile'),  'url'  => 'index.php?app=member&act=profile', 'name' => 'my_profile', ),
                'my_password' => array( 'text' => Lang::get('my_password'), 'url'  => 'index.php?app=member&act=password', 'name' => 'my_password', ),			
                
                //'friend'      => array( 'text' => Lang::get('friend'),      'url'  => 'index.php?app=friend', 'name' => 'friend', ),
                //'my_favorite' => array( 'text' => Lang::get('my_favorite'), 'url'  => 'index.php?app=my_favorite', 'name' => 'my_favorite', ),
                'my_email'    => array( 'text' => Lang::get('my_email'),    'url'  => 'index.php?app=member&act=email', 'name' => 'my_email', ),	
                //'my_certificate' => array( 'text' => Lang::get('my_certificate'), 'url'  => 'index.php?app=member&act=certificate', 'name' => 'my_certificate', ),	
            ),
        );		
        return $menu;
    }
}

/**
 *    店铺管理子系统基础类
 *
 *    @author liangcajian QQ632324010
 *    @usage    none
 */
class StoreadminbaseApp extends MemberbaseApp
{
    function _run_action()
    {
        /* 只有登录的用户才可访问 */
        if (!$this->visitor->has_login && !in_array(ACT, array('login', 'register', 'check_user')))
        {
            if (!IS_AJAX)
            {
                header('Location:index.php?app=member&act=login&ret_url=' . rawurlencode($_SERVER['PHP_SELF'] . '?' . $_SERVER['QUERY_STRING']));
                return;
            }
            else
            {
                $this->json_error('login_please');
                return;
            }
        }
        $referer = $_SERVER['HTTP_REFERER'];
        if (strpos($referer, 'act=login') === false)
        {
            $ret_url = $_SERVER['HTTP_REFERER'];
            $ret_text = 'go_back';
        }
        else
        {
            $ret_url = SITE_URL . '/';
            $ret_text = 'back_index';
        }

        /* 检查是否是店铺管理员 */
        if (!$this->visitor->get('manage_store'))
        {
            /* 您不是店铺管理员 */
            $this->show_warning(
                'not_storeadmin',
                'apply_now', 'index.php?app=apply',
                $ret_text, $ret_url
            );

            return;
        }

        /* 检查是否被授权 */
        $privileges = $this->_get_privileges();
        if (!$this->visitor->i_can('do_action', $privileges))
        {
            $this->show_warning('no_permission', $ret_text, $ret_url);
            return;
        }

        /* 检查店铺开启状态 */
        $state = $this->visitor->get('state');
        if ($state == 0)
        {
            $this->show_warning('apply_not_agree', $ret_text, $ret_url);
            return;
        }
		elseif ($state == 3)
        {
            $this->show_warning('store_is_closed', $ret_text, $ret_url);

            return;
        }

        /* 检查附加功能 */
        if (!$this->_check_add_functions())
        {
            $this->show_warning('not_support_function', $ret_text, $ret_url);
            return;
        }

        parent::_run_action();
    }
    function _get_privileges()
    {
        $store_id = $this->visitor->get('manage_store');
        $privs = $this->visitor->get('s');

        if (empty($privs))
        {
            return '';
        }

        foreach ($privs as $key => $admin_store)
        {
            if ($admin_store['store_id'] == $store_id)
            {
                return $admin_store['privs'];
            }
        }
    }
    
    /* 获取当前店铺所使用的主题 */
    function _get_theme()
    {
        $model_store =& m('store');
        $store_info  = $model_store->get($this->visitor->get('manage_store'));
        $theme = !empty($store_info['theme']) ? $store_info['theme'] : 'default|default';
        list($curr_template_name, $curr_style_name) = explode('|', $theme);
        return array(
            'template_name' => $curr_template_name,
            'style_name'    => $curr_style_name,
        );
    }

    function _check_add_functions()
    {
        $apps_functions = array( // app与function对应关系
            'seller_groupbuy' => 'groupbuy',
            'coupon' => 'coupon',
        );
        if (isset($apps_functions[APP]))
        {
            $store_mod =& m('store');
            $settings = $store_mod->get_settings($this->_store_id);
            $add_functions = isset($settings['functions']) ? $settings['functions'] : ''; // 附加功能
            if (!in_array($apps_functions[APP], explode(',', $add_functions)))
            {
                return false;
            }
        }
        return true;
    }
}

/**
 *    店铺控制器基础类
 *
 *    @author liangcajian QQ632324010
 *    @usage    none
 */
class StorebaseApp extends FrontendApp
{
    var $_store_id;

    /**
     * 设置店铺id
     *
     * @param int $store_id
     */
    function set_store($store_id)
    {
        $this->_store_id = intval($store_id);

        /* 有了store id后对视图进行二次配置 */
        $this->_init_view();
        $this->_config_view();
    }

    function _config_view()
    {
        parent::_config_view();
        $template_name = $this->_get_template_name();
        $style_name    = $this->_get_style_name();

        $this->_view->template_dir = ROOT_PATH . "/themes/store/{$template_name}";
        $this->_view->compile_dir  = ROOT_PATH . "/temp/compiled/store/{$template_name}";
        $this->_view->res_base     = SITE_URL . "/themes/store/{$template_name}/styles/{$style_name}";
		$this->_view->cache_dir    = ROOT_PATH . "/temp/caches_html/{$template_name}";//缓存模板目录 by liangcaijian
    }

    /**
     *    获取当前店铺所设定的模板名称
     *
     *    @author liangcajian QQ632324010
     *    @return    string
     */
    function _get_template_name()
    {
        $store_info = $this->_get_store_info();
        $theme = !empty($store_info['theme']) ? $store_info['theme'] : 'default|default';
        list($template_name, $style_name) = explode('|', $theme);

        return $template_name;
    }

    /**
     *    获取当前店铺所设定的风格名称
     *
     *    @author liangcajian QQ632324010
     *    @return    string
     */
    function _get_style_name()
    {
        $store_info = $this->_get_store_info();
        $theme = !empty($store_info['theme']) ? $store_info['theme'] : 'default|default';
        list($template_name, $style_name) = explode('|', $theme);

        return $style_name;
    }
	

    /**
     * 取得店铺信息
     */
    function get_store_data()
    {
		$cache_server =& cache_server();
        $store_key = 'function_get_store_data_' . $this->_store_id;
		$store = $cache_server->get($store_key);
		if ($store === false)
        {
            $store = $this->_get_store_info();

			//把店铺的页头背景设置给提纯出来
			$store['store_banner_show'] && $store['store_banner_show'] = unserialize($store['store_banner_show']);
			if ($store['head_img_position'])
			{
				list($head_img_repeat, $head_img_align,  $head_img_color) = explode('|', $store['head_img_position']);
				$store['head_img_repeat']      = $head_img_repeat;
				$store['head_img_align']       = $head_img_align;
				$store['head_img_color']       = $head_img_color;
			}
			//把店铺的页面背景设置给提纯出来
			if ($store['bg_img_position'])
			{
				list($bg_img_repeat, $bg_img_align, $bg_img_attachment, $bg_img_color) = explode('|', $store['bg_img_position']);
				$store['bg_img_repeat']      = $bg_img_repeat;
				$store['bg_img_align']       = $bg_img_align;
				$store['bg_img_attachment']  = $bg_img_attachment;
				$store['bg_img_color']       = $bg_img_color;
			}
		
			$cache_server->set($store_key, $store, 7200);//两个小时更新一次
		}
		

        return $store;
    }
    /* 取得店铺信息 */
    function _get_store_info()
    {
        if (!$this->_store_id)
        {
            /* 未设置前返回空 */
            return array();
        }
        static $store_info = null;
        if ($store_info === null)
        {
            $store_mod  =& m('store');
            $store_info = $store_mod->get_info($this->_store_id);
        }

        return $store_info;
    }

    /* 取得店主信息 */
    function _get_store_owner()
    {
        $user_mod =& m('member');
        $user = $user_mod->get($this->_store_id);

        return $user;
    }

	
}

/* 实现消息基础类接口 */
class MessageBase extends MallbaseApp {};

/* 实现模块基础类接口 */
class BaseModule  extends FrontendApp {};

/* 消息处理器 */
require(ROOT_PATH . '/eccore/controller/message.base.php');

?>